Part Number Hot Search : 
CDBER54 UFT40150 2N2906 CDBER54 1E9CS M2114 ZD524 2N440
Product Description
Full Text Search
 

To Download SM5952E Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 1 - product list ................................................................................................................................................................... 3 description .................................................................................................................................................................... 3 ordering information ..................................................................................................................................................... 3 features ........................................................................................................................................................................ 3 pin configuration .......................................................................................................................................................... 4 block diagram ............................................................................................................................................................... 7 special function register (sfr) .................................................................................................................................. 9 function description ................................................................................................................................................... 12 1. general features ........................................................................................................................................... 12 1.1 embedded flash ................................................................................................................................... 12 1.2 io pads ................................................................................................................................................. 12 1.3 system control register (sconf) ....................................................................................................... 12 2. instruction set ................................................................................................................................................ 13 3. memory structure .......................................................................................................................................... 17 3.1 program memory .................................................................................................................................. 17 3.2 data memory ......................................................................................................................................... 18 3.3 data memory - lower 128 byte (00h to 7fh) ......................................................................................... 18 3.4 data memory - higher 128 byte (80h to ffh) ........................................................................................ 18 3.5 data memory - expanded 768 bytes ($0000 to $02ff) ....................................................................... 18 4. cpu engine ................................................................................................................................................... 22 4.1 accumulator .......................................................................................................................................... 22 4.2 b register ............................................................................................................................................. 22 4.3 program status word ............................................................................................................................ 23 4.4 stack pointer ......................................................................................................................................... 23 4.5 data pointer .......................................................................................................................................... 23 5. gpio .............................................................................................................................................................. 24 6. timer 0 and timer 1 ....................................................................................................................................... 25 6.1 timer/counter mode control register (tmod) ....................................................................................... 25 6.2 timer/counter control register (tcon) ................................................................................................. 26 6.3 mode 0 (13 - bit counter/timer) .............................................................................................................. 26 6.4 mode 1 (16 - bit counter/timer) .............................................................................................................. 27 6.5 mode 2 (8 - bit auto - reload counter/timer) ............................................................................................ 27 6.6 mode 3 (timer 0 acts as two independent 8 bit timers / counters) ..................................................... 27 7. timer 2 ........................................................................................................................................................... 29 7.1 capture mode ....................................................................................................................................... 30 7.2 auto - reload (up or down counter) ....................................................................................................... 31 7.3 programmable clock out ....................................................................................................................... 32 8. serial interface ? uart ................................................................................................................................. 34 8.1 serial int erface ...................................................................................................................................... 34 8.1.1 mode 0 .......................................................................................................................................... 35 8.1.2 mode 1 .......................................................................................................................................... 35 8.1.3 mode 2 .......................................................................................................................................... 36 8.1.4 mode 3 .......................................................................................................................................... 36 8.2 multiprocessor communication of serial interface ............................................................................... 36 8.3 baud rate generator ............................................................................................................................ 37 8.3.1 serial interface mode 0 ................................................................................................................ 37 8.3.2 serial interface mode 2 ................................................................................................................ 37 8.3.3 serial interface mode 1 and 3 ...................................................................................................... 37 9. interrupt .......................................................................................................................................................... 38 10. watch dog timer ........................................................................................................................................... 40 11. power management unit ............................................................................................................................... 42 11.1 idle mode .............................................................................................................................................. 42 11.2 power down mode ................................................................................................................................ 42 12. pulse width modulation (pwm) ..................................................................................................................... 44 13. two - wire series interface (twsi) ................................................................................................................. 46 14. in - system programming (internal isp) .......................................................................................................... 49
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 2 - 14.1 isp service program .............................................................................................................................. 49 14.2 lock bit (n) ........................................................................................................................................... 49 14.3 program the isp service program ........................................................................................................ 50 14.4 initiate isp service program ................................................................................................................. 50 14.5 isp register ? is pfah, ispfal, ispfd and ispc ............................................................................... 51 operating conditions .................................................................................................................................................. 53 dc characteristics ...................................................................................................................................................... 53
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 3 - product list sm5 952e w40pp , SM5952E w44 j p , SM5952E w44qp, description the SM5952E series product is an 8 - bit single chip micro controller with 8 k b +4kb flash & 1kb s ram embedded. it has in - system programming (isp) function and is a derivative of the 8052 micro controller f amily. SM5952E is a versatile and cost effective controller for those applications which demand up to 3 6 i/o pins, or applications which need up to 8k b +4kb byte flash memory either for program or for data or mixed. to program the on - chip flash memory, a commercial writer is available to do it in parallel programming method. the on - chip flash memory can be programmed in either parallel or serial interface with its isp feature. ordering information SM5952E ihhkl yww i: process identifier { w = 2 . 4 v ~ 5.5v} hh: pin count k: package type postfix {as table below } l:pb free identifier {no text is non - pb free , ?p? is pb free} y : year ww : week postfix package p pdip j plcc q pqfp features ? main flash rom 8k b +4 k b . ? working voltage 2 . 4 v~5.5v runs up to 40mhz ? general 8052 family compatible with 12 clocks in one machine cycle . ? 6 clocks in one machine cycle is also supported . ? 256 bytes sram as standard 8052 . ? on - chip 768 bytes expanded ram. ? 16- bit data pointers (dptr). ? one serial peripheral interfaces in full dupl ex mode (uart). - synchronous mode, fixed baud rate. - 8 - bit uart mode, variable baud rate. - 9 - bit uart mode, fixed baud rate. - 9 - bit uart mode, variable baud rate. ? three 16 - bit timer/counters (timer 0, 1, 2). ? one watch dog timer (wdt) . ? one iic interface (master / slave mode). ? two 8 - bit/5 - bit configurable pwm output channels . ? isp/iap functions. ? isp service program space configurable in n* 512 byte (n=0 to 8) size. ? seven interrupt sources with two priority levels. ? four 8 - bit i/o ports and additional one 4 - bit i/o p orts. ? io pad esd over 4kv . ? enhance user code protection. ? power management unit for idle and power down modes.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 4 - pin configuration 40 pin p dip 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 t2/p1.0 t2ex/p1.1 pwm0/p1.2 vdd pwm1/p1.3 p1.4 p1.5 scl/p1.6 sda/p1.7 reset rxd/p3.0 txd/p3.1 int0/p3.2 int1/p3.3 t0/p3.4 t1/p3.5 wr/p3.6 rd/p3.7 xtal2 xtal1 vss p0.0/ad0 p0.1/ad1 p0.2/ad2 p0.3/ad3 p0.4/ad4 p0.5/ad5 p0.6/ad6 p0.7/ad7 ea ale psen p2.7/a15 p2.6/a14 p2.5/a13 p2.4/a12 p2.3/a11 p2.2/a10 p2.1/a9 p2.0/a8 SM5952Eihhpp yww (40l pdip top view)
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 5 - 44 pin p lcc 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 28 27 26 25 24 23 22 21 39 38 37 36 35 34 33 32 31 30 29 40 41 42 43 44 p1.0/t2 p1.1/t2ex p1.2/pwm0 p1.3/pwm1 p1.4 p4.2 p1.5 scl/p1.6 sda/p1.7 reset rxd/p3.0 txd/p3.1 int0/p3.2 int1/p3 .3 t0/p3.4 t1/p3.5 p4.3 wr/p3.6 rd/p3.7 xtal2 xtal1 vss p4.0 a12/p2.4 a11/p2.3 a10/p2.2 a9/p2.1 a8/p2.0 p0.4/ad4 p0.5/ad5 p0.6/ad6 p0.7/ad7 ea ale psen p2.7/a15 p2.6/a14 p2.5/a13 p4.1 vdd p0.0/ad0 p0.1/ad1 p0.2/ad2 p0.3/ad3 SM5952E ihhjp yww (44l plcc top view )
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 6 - 44 pin p qfp t2/p1.0 t2ex/p1.1 pwm0/p1.2 pwm1/p1.3 p1.4 p4.2 p1.5 scl/p1.6 sda/p1.7 reset rxd/p3.0 txd/p3.1 int0/p3.2 int1/p3.3 t0/p3.4 t1/p3.5 p4.3 p3.6/wr p3.7/rd xtal2 xtal1 vss p4.0 p2.4/a12 p2.3/a11 p2.2/a10 p2.1/a9 p2.0/a8 p0.4/ad4 p0.5/ad5 p0.6/ad6 p0.7/ad7 ea ale psen p2.7/a15 p2.6/a14 p2.5/a13 p4.1 vdd ad0/p0.0 ad1/p0.1 ad2/p0.2 ad3/p0.3 1 2 3 4 5 6 7 8 9 10 11 13 14 15 12 22 21 20 19 18 17 16 24 23 33 32 31 30 29 28 27 26 25 43 44 34 35 36 38 39 40 41 42 37 SM5952E ihhqp yww (44l pqfp top view)
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 7 - block diagram ram addr register ram256 port0 latch port2 latch flash rom isp address generator program counter dptr port0 driver port2 driver b register acc tmp2 tmp1 alu stack pointer timer0/1 timer2 uart psw wdt port3 latch port1 latch port4 latch port3 driver port1 driver port4 driver control unit p2 .0 ~ p2 .7 p0 .0 ~ p0 .7 p1 .0 ~ p1 .7 p3 .0 ~ p3 .7 p4 .0 ~ p4 .3 # psen ale # ea reset xtal 1 xtal 2 auxram (768 byte) twsi ( i2c )
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 8 - pin description 40 l pdip 4 4 l plcc 4 4 l pqfp symbol i/o description - 1 39 p4.2 i/o bit 2 of port 4 1 2 40 p1.0/t2 i/o bit 0 of port 1 & timer 2 external input clock 2 3 41 p1.1/t2ex i/o b it 1 of port 1 & timer 2 capture trigger 3 4 42 p1.2 / pwm 0 i/o bit 2 of port 1 & pwm channel 0 4 5 43 p1.3 / pwm1 i/o bit 3 of port 1 & pwm channel 1 5 6 44 p1.4 i/o bit 4 of port 1 6 7 1 p1.5 i/o bit 5 of port 1 7 8 2 p1.6 /scl i/o bit 6 of port 1 & ii c s cl pin 8 9 3 p1.7 /sda i/o bit 7 of port 1 & iic sda pin 9 10 4 reset i reset pin 10 11 5 p3.0/rxd i/o bit 0 of port 3 & serial interface channel receive data - 12 6 p4.3 i/o bit 3 of port 4 11 13 7 p3.1/txd i/o bit 1 of port 3 & serial interface ch annel transmit data 12 14 8 p3.2 /int0 i/o bit 2 of port 3 & interrupt 0 13 15 9 p3.3/ int1 i/o bit 3 of port 3 & interrupt 1 14 16 10 p3.4 /t0 i/o bit 4 of port 3 & timer 0 external input 15 17 11 p3.5/ t1 i/o bit 5 of port 3 & timer 1 external input 16 18 12 p3.6/ wr i/o bit 6 of port 3 & external memory write 17 19 13 p3. 7 / rd i/o bit 7 of port 3 & external memory read 18 20 14 xtal2 i/o crystal output 19 21 15 xtal1 i/o crystal input 20 22 16 vss i ground - 23 17 p4.0 i/o bit 0 of port 4 21 24 18 p2.0/a8 i/o bit 0 of port 2 & bit 8 of external memory address 22 25 19 p2.1/a9 i/o bit 1 of port 2 & bit 9 of external memory address 23 26 20 p2.2/a10 i/o bit 2 of port 2 & bit 10 of external memory address 24 27 21 p2.3/a11 i/o bit 3 of port 2 & bit 11 of external memory address 25 28 22 p2.4/ a12 i/o bit 4 of port 2 & bit 12 of external memory address 26 29 23 p2.5/ a13 i/o bit 5 of port 2 & bit 13 of external memory address 27 30 24 p2.6/ a14 i/o bit 6 of port 2 & bit 14 of external memory address 28 31 25 p2. 7 / a15 i/o bit 7 of port 2 & bit 15 of external memory address 29 32 26 psen o program storage enable 30 33 27 ale o address latch enable - 34 28 p4.1 i/o bit 1 of port 4 31 35 29 ea i external access 32 36 30 p0.7/ ad7 i/o bit 7 of port 0 & data/address bit 7 of external memory 33 37 31 p0. 6 / ad6 i/o bit 6 of port 0 & data/address bit 6 of external memory 34 38 32 p0.5/ ad5 i/o bit 5 of port 0 & data/address bit 5 of external memory 35 39 33 p0.4/ ad4 i/o bit 4 of port 0 & data/address bit 4 of external memory 36 40 34 p0.3/ ad3 i/o bit 3 of port 0 & data/address bit 3 of external memory 37 41 35 p0.2/ ad2 i/o bit 2 of port 0 & data/address bit 2 of external memory 38 42 36 p0.1/ ad1 i/o bit 1 of port 0 & data/address bit 1 of external memory 39 43 37 p0.0/ ad0 i/o bit 0 of port 0 & data/address bit 0 of external memory 40 44 38 vdd i power supply
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 9 - special function register (sfr) a map of the special function registers is shown as below: hex \ bin x000 x001 x010 x011 x100 x101 x110 x111 bin /hex f8 ff f0 b ispfah ispfal ispfd ispc f7 e8 ef e0 acc e7 d8 p4 df d0 psw pwmc0 pwmc1 d7 c8 t2con t2mod rc ap2 l rcap2 h tl2 th2 cf c0 twsis twsia twsic1 twsic2 twsitxd twsirxd c7 b8 i p ip1 sconf bf b 0 p3 pwdd0 pwmd1 b7 a8 ie ie1 ifr af a0 p2 a7 98 scon sbuf p1con wdtc 9f 90 p1 97 88 tcon tmod tl0 tl1 th0 th1 8f 80 p0 sp dpl dph rcon dbank pcon 87 hex \ bin x000 x001 x010 x011 x100 x101 x110 x111 bin/hex
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 10 - note: spe cial function registers reset values and description for SM5952E . register location reset value description 1 p0 80h ffh port 0 2 sp 81h 07h stack pointer 3 dpl 82h 00h data pointer 0 low byte 4 dph 83h 00h data pointer 0 high byte 5 rcon 85h 00h r am control 6 dbank 86h 0 1 h data ram bank select 7 pcon 87h 0 0h power control 8 tcon 88h 00h timer/counter control 9 tmod 89h 00h timer mode control 10 tl0 8ah 00h timer 0, low byte 11 tl1 8bh 00h timer 1, low byte 1 2 th0 8ch 00h timer 0, high byte 1 3 th1 8dh 00h timer 1, high byte 1 4 p1 90h ffh port 1 1 5 scon 98h 00h serial port 0, control register 1 6 sbuf 99h 00h serial port 0, data buffer 17 p1con 9bh 00h p1 control 18 wdtc 9fh 00h watch dog timer control 1 9 p2 a0h ffh port 2 20 ie a8h 00h interrupt enable 21 ie1 a 9h 00h interrupt enable 1 22 ifr aah 00h interrupt flag for read 23 p3 b0h ffh port 3 24 pwmd0 b3h 00h pwm data 0 25 pwmd1 b4h 00h pwm data 1 26 ip b8h 00h interrupt priority 27 ip1 b9h 00h interrupt priority 1 28 sconf bfh 02h system control register 29 twsis c 0h 00h twsi status 30 twsia c1h a0h twsi address 31 twsic1 c2h 01h twsi control 1 32 twsic2 c3h 00h twsi control 2 33 twsitxd c4h ffh twsi transmit data 34 twsirxd c5h 00h twsi receive data 35 t2con c8h 00h tim er 2 control 36 t2mod c9h 00h timer 2 mode 37 rcap2l cah 00h timer2 capture low 38 rcap2h cbh 00h timer2 capture high 39 tl2 cch 00h timer 2, low byte 40 th2 cdh 00h timer 2, high byte 41 psw d0h 00h program status word
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 11 - 42 pwmc0 d3h 00h pwm control 0 43 pwmc1 d4h 00h pwm control 1 44 p4 d8h xfh port 4 45 acc e0h 00h accumulator 46 b f0h 00h b register 47 ispfah f4h 00h isp flash address - high register 48 ispfal f5h 00h isp flash address - low register 49 ispfd f6h 00h isp flash data register 50 isp c f7h 00h isp control register
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 12 - function description 1. general features SM5952E is an 8 - bit micro - controller. all of its functions and the detailed meanings of sfr will be given in the following sections. 1.1 embedded flash the program can be loaded into the embedded 8kb+4kb flash memory via its writer or in - system programming (isp). 1.2 io pads the SM5952E has f ive i/o ports: port 0, port 1, port 2 , port 3 , port 4 . port 0 ~ port 3 are 8 - bit ports . port 4 is 4 - bit port . these are: quasi - bidirectional (standard 8051 port outputs) with port 1~ 4 , and open drain with port 0 . all the pads are with slew rate to reduce emi. the io pads can withstand esd in human body mode guaranteeing the SM5952E ?s quality in high electro - static environments. 1.3 system control register (sconf ) mnemonic: sconf address: bfh 7 6 5 4 3 2 1 0 reset wdr - - pdwue - ispe ome alei 0 2 h wdr : watch dog timer reset. when system reset by watch dog timer overflow, wdr will be set to 1. user should check wdr bit whenever un - predicted reset happene d. pdwue : power down wake - up enable bit. set 1 to enable wake - up from power - down state by external pin int0 or int1. ispe : isp function enable bit. when enable the isp function, ispe will be set to 1. ome : on - chip 768b expanded ram enable b it. set 1 to enable on - chip 768b expanded ram access. alei : ale output inhibit bit. when default, it can inhibit the clock signal in (fosc/6) hz output to the ale pin. when set to 1, the ale pin output will stop to reduce emi.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 13 - 2. instruction set a ll sm595 2e instructions are binary code compatible and perform the same functions as they do with the industry standard 8051. the following tables give a summary of the instruction set cycles of the SM5952E microcontroller core. table 2 - 1 : arithmetic operations mnemonic description code bytes cycles add a,rn add register to accumulator 28- 2f 1 1 add a,direct add direct byte to accumulator 25 2 1 add a,@ri add indirect ram to accumulator 26- 27 1 1 add a,#data add i mmediate data to accumulator 24 2 1 addc a,rn add register to accumulator with carry flag 38- 3f 1 1 addc a,direct add direct byte to a with carry flag 35 2 1 addc a,@ri add indirect ram to a with carry flag 36- 37 1 1 addc a,#data add immediate data to a with carry flag 34 2 1 subb a,rn subtract register from a with borrow 98- 9f 1 1 subb a,direct subtract direct byte from a with borrow 95 2 1 subb a,@ri subtract indirect ram from a with borrow 96- 97 1 1 subb a,#data subtract immediate data from a wit h borrow 94 2 1 inc a increment accumulator 04 1 1 inc rn increment register 08- 0f 1 1 inc direct increment direct byte 05 2 1 inc @ri increment indirect ram 06- 07 1 1 inc dptr increment data pointer a3 1 2 dec a decrement accumulator 14 1 1 dec rn decrement register 18- 1f 1 1 dec direct decrement direct byte 15 2 1 dec @ri decrement indirect ram 16- 17 1 1 mul ab multiply a and b a4 1 4 div divide a by b 84 1 4 da a decimal adjust accumulator d4 1 1
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 14 - table 2 - 2 : logic operations mnemonic description code bytes cycles anl a,rn and register to accumulator 58- 5f 1 1 anl a,direct and direct byte to accumulator 55 2 1 anl a,@ri and indirect ram to accumulator 56- 57 1 1 anl a,#data and immediate data to accumulator 54 2 1 anl direct,a and accumulator to direct byte 52 2 1 anl direct,#data and immediate data to direct byte 53 3 2 orl a,rn or register to accumulator 48- 4f 1 1 orl a,direct or direct byte to accumulator 45 2 1 orl a,@ri or indirect ra m to accumulator 46- 47 1 1 orl a,#data or immediate data to accumulator 44 2 1 orl direct,a or accumulator to direct byte 42 2 1 orl direct,#data or immediate data to direct byte 43 3 2 xrl a,rn exclusive or register to accumulator 68- 6f 1 1 xrl a,dir ect exclusive or direct byte to accumulator 65 2 1 xrl a,@ri exclusive or indirect ram to accumulator 66- 67 1 1 xrl a,#data exclusive or immediate data to accumulator 64 2 1 xrl direct,a exclusive or accumulator to direct byte 62 2 1 xrl direct,#data e xclusive or immediate data to direct byte 63 3 2 clr a clear accumulator e4 1 1 cpl a complement accumulator f4 1 1 rl a rotate accumulator left 23 1 1 rlc a rotate accumulator left through carry 33 1 1 rr a rotate accumulator right 03 1 1 rrc a rota te accumulator right through carry 13 1 1 swap a swap nibbles within the accumulator c4 1 1
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 15 - table 2 - 3 : data transfer mnemonic description code bytes cycles mov a,rn move register to accumulator e8 - ef 1 1 mov a,direct move direct byte to accumulator e5 2 1 mov a,@ri move indirect ram to accumulator e6 - e7 1 1 mov a,#data move immediate data to accumulator 74 2 1 mov rn,a move accumulator to register f8 - ff 1 1 mov rn,direct move direct byte to register a 8 - af 2 2 mov rn,#data move immediate data to register 78- 7f 2 1 mov direct,a move accumulator to direct byte f5 2 1 mov direct,rn move register to direct byte 88- 8f 2 2 mov direct1,direct2 move direct byte to direct byte 85 3 2 mov direct,@ri move ind irect ram to direct byte 86- 87 2 2 mov direct,#data move immediate data to direct byte 75 3 2 mov @ri,a move accumulator to indirect ram f6 - f7 1 1 mov @ri,direct move direct byte to indirect ram a6 - a7 2 2 mov @ri,#data move immediate data to indirect r am 76- 77 2 1 mov dptr,#data16 load data pointer with a 16 - bit constant 90 3 2 movx a,@ri move external ram (8 - bit addr.) to a e2 - e3 1 2 movx a,@dptr move external ram (16 - bit addr.) to a e0 1 2 movx @ri,a move a to external ram (8 - bit addr.) f2 - f3 1 2 movx @dptr,a move a to external ram (16 - bit addr.) f0 1 2 movc a,@a+dptr move code byte relative to dptr to accumulator 93 1 2 movc a,@a+pc move code byte relative to pc to accumulator 83 1 2 push direct push direct byte onto stack c0 2 2 pop direct p op direct byte from stack d0 2 2 xch a,rn exchange register with accumulator c8 - cf 1 1 xch a,direct exchange direct byte with accumulator c5 2 1 xch a,@ri exchange indirect ram with accumulator c6 - c7 1 1 xchd a,@ri exchange low - order nibble indir. ram with a d6 - d7 1 1
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 16 - table 2 - 4 : program branches mnemonic description code bytes cycles acall addr11 absolute subroutine call xxx11 2 2 lcall addr16 long subroutine call 12 3 2 ret from subroutine 22 1 2 re ti from interrupt 32 1 2 ajmp addr11 absolute jump xxx01 2 2 ljmp addr16 long iump 02 3 2 sjmp rel short jump (relative addr.) 80 2 2 jmp @a+dptr jump indirect relative to the dptr 73 1 2 jz rel jump if accumulator is zero 60 2 2 jnz rel jump if accu mulator is not zero 70 2 2 jc rel jump if carry flag is set 40 2 2 jnc jump if carry flag is not set 50 2 2 jb bit,rel jump if direct bit is set 20 3 2 jnb bit,rel jump if direct bit is not set 30 3 2 jbc bit,direct rel jump if direct bit is set and c lear bit 10 3 2 cjne a,direct rel compare direct byte to a and jump if not equal b5 3 2 cjne a,#data rel compare immediate to a and jump if not equal b4 3 2 cjne rn,#data rel compare immed. to reg. and jump if not equal b8 - bf 3 2 cjne @ri,#data rel com pare immed. to ind. and jump if not equal b6 - b7 3 2 djnz rn,rel decrement register and jump if not zero d8 - df 2 2 djnz direct,rel decrement direct byte and jump if not zero d5 3 2 nop no operation 00 1 1 table 2 - 5 : boolean manipulation mnemonic description code bytes cycles clr c clear carry flag c3 1 1 clr bit clear direct bit c2 2 1 setb c set carry flag d3 1 1 setb bit set direct bit d2 2 1 cpl c complement carry flag b3 1 1 cpl bit complemen t direct bit b2 2 1 anl c,bit and direct bit to carry flag 82 2 2 anl c,/bit and complement of direct bit to carry b0 2 2 orl c,bit or direct bit to carry flag 72 2 2 orl c,/bit or complement of direct bit to carry a0 2 2 mov c,bit move direc t bit to carry flag a2 2 1 mov bit,c move carry flag to direct bit 92 2 2
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 17 - 3. memory structure the SM5952E memory structure follows general 8052 structure. it is 8kb+4kb program memory . 3.1 program memory the SM5952E has 8kb+4kb on- chip flash memory which can be used as general program memory, on which include up to 4 k byte specific isp service program memory space. the address range for the 8kb+4kb is $0000 h to $ 2 fff h . the address range for the isp service program is $ 2 0 00h to $ 2 fff h . the isp service progr am size can be partitioned as n blocks of 512 byte (n=0 to 8). when n=0 means no isp service program space available, total 8kb+4kb memory used as program memory. when n = 1 means address $ 2 e0 0 h to $ 2 fff h reserved for isp service program. when n=2 means me mory address $ 2 c 00 h to $ 2 fff h reserved for isp service program?etc. value n can be set and programmed into SM5952E configuration by writer. as shown in fig. 3 - 1 . 2fff 2e00 2c00 2a00 2800 2600 2400 2200 2000 0000 isp service program space, up to 4k 8k program memory space n=8 n=7 n=6 n=5 n=4 n=3 n=2 n=1 n=0 fig. 3 - 1 : SM5952E programmable flash
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 18 - 3.2 data memory the SM5952E has 256b +768b on - chip sram . 256b of it are the same as general 8052 internal memory structure while the expanded 768 bytes on - chip sram can be accessed by external memory addressi ng method ( by instruction movx ) . as shown in fig. 3 - 2 . higher 128 bytes (accessed by indirect addressing mode only) lower 128 bytes (accessed by direct & indirect addressing mode ) sfr (accessed by direct addressing mode only) expanded 768 bytes (accessed by direct external addressing mode by instruction movx) 00 7f 80 ff 80 ff 0000 02ff fig. 3 - 2 : ram architecture 3.3 data memory - lower 128 byte (00h to 7f h) data memory 00h to ffh is the same as 8052. the address 00h to 7fh can be accessed by direct and indirect addressing modes. address 00h to 1fh is register area. address 20h to 2fh is memory bit area. address 30h to 7fh is for general memory area. 3.4 data memory - higher 128 byte (80h to ffh) the address 80h to ffh can be accessed by indirect addressing mode. address 80h to ffh is data area. 3.5 data memory - expanded 768 bytes ($0 000 to $ 02 ff) from external address 0000h to 0 2 ffh is the on - chip expanded sram a rea, total 768 bytes. this area can be accessed by external direct addressing mode (by instruction movx). mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst expanded ram sconf system configuration register bfh wdr - - pdwu e - ispe ome alei 0 2 h rcon internal ram control register 85h - - - - - - rams 1 rams 0 00h dbank data bank control register 86h bse - - - bs3 bs2 bs1 bs0 0 1 h
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 19 - mnemonic: sconf address: bfh 7 6 5 4 3 2 1 0 reset wdr - - pdwue - ispe ome alei 0 2 h ome: on - chip 768b expanded ram enable bit. set 1 to enable on - chip 768b expanded ram access. there are two methods to access on - chip 768 bytes of expanded ram. the first one is to use movx instruction either by movx @dptr or by movx @ri. the other is to use a sp ecific addressing bank switching scheme combined with direct addressing mov instruction. method 1 : by movx instruction the 768 bytes on - chip expanded ram can be accessed by movx instruction with ome bit in sconf register enabled. if movx @dptr is used , the address range larger than 768b will force to access external data memory automatically. if ome is disabled, ic will always access external data memory. ome is 1 in default setting. the 768 bytes of on - chip expanded ram can also be accessed by movx @r i instruction. t he content in ri is concatenated with rams1 and rams0 bit in rcon register in order to address on - chip 768bytes expanded ram and off - chip ram totally up to 64 k b memory range. rams1 and rams0 bit in rcon register is the 256b bank selection while using movx @ri to access expanded ram once ome bit in sconf register is set. mnemonic: rcon address: 85 h 7 6 5 4 3 2 1 0 reset - - - - - - rams1 rams0 00h ome rams1 rams0 m apped on - chip expanded ram address note 1 0 0 $0000 - $00ff 1 0 1 $010 0 - $01ff 1 1 0 $0200 - $02ff 1 1 1 - mapped to off - chip ram address {p2 , ri} 0 x x - mapped to off - chip ram address {p2 , ri} table 3 - 1 : mapped address for on - chip expanded ram
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 20 - ome on-chip 768b expanded ram bank 0 (256b) bank 1 (256b) bank 2 (256b) 768 bytes movx @ri instrcution a[9:0] movx @dptr instrcution sel dptr {rams1,rams0,@ri} dptr {dbank[3:0],direct address} chip selection of on-chip expanded ram read write control logic dbank[7] {rams1,rams0} mux fig . 3 - 3: access on - chip expanded ram s cheme method 2 : by direct addressing mov instruction the 768b on - chip expanded data ram and 256b scratchpad ram is combined together to form a 1kb memory space. this 1kb space is logically partition ed into 16 pieces of 64b ram bank. this 1kb space can be accessed through a single - addressing - type mov instruction with bank - switch technique. in this technique, the 64b address range $40 - $7f in direct addressing mov instruction is used as mapping window and is concatenated with bit3 ? bit0 in dbank registe r to address up to 1kb memory space. while accessed by direct addressing mov instruction , the 768b expanded ram is address - offset by 256 bytes upward and concatenate s with scratchpad ram to form a 1kb memory space. hence 768b expanded ram occupies address space from $100 to $2ff and 256b scratchpad ram is located from $000 to $0ff. with the address mapping window and bank switching scheme, user can use single type mov instruction to access entire 1k bytes on - chip data memory space. f or example, users can have following assembly codes to write data 0x30 into expanded 768b data ram address $101 : mov dbank,#88h mov a,#30h mov 41h, a
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 21 - movx @dptr instrcution dptr dbank[7] {rams1,rams0} ome bank 4-7 (64b x 4) bank 8-11 (64b x 4) bank 12-15 (64b x 4) 768 bytes movx @ri instrcution a[9:0] sel dptr {rams1,rams0,@ri} {dbank[3:0],direct address} chip selection of on-chip expanded ram and scratchpad ram read write control logic scratchpad ram bank 0-3 (64b x 4) on-chip 768b expanded ram 1kb memory space mux fig .3 - 4 : access on - chip expanded ram and scratchpad ram with both in single 1kb addressing space scheme mnemonic: dbank address: 86 h 7 6 5 4 3 2 1 0 reset bse - - - bs3 bs2 bs1 bs0 0 1 h bse : set 1 to enable data banking function. bs[3:0] : one is selected from 16 pieces of 64b data memory bank. bse bs3 bs2 bs1 bs0 m apped window : $40 - $7f logically addressed range in 1k memory space physical address 1 0 0 0 0 $000 ? $03f scratchpad ram ( $00 ? $ff ) 1 0 0 0 1 $040 ? $07f 1 0 0 1 0 $080 ? $0bf 1 0 0 1 1 $0c0 ? $0ff 1 0 1 0 0 $100 ? $13f expanded ram ( $000 ? $2ff) 1 0 1 0 1 $140 ? $17f 1 0 1 1 0 $180 ? $1bf 1 0 1 1 1 $1c0 ? $1ff 1 1 0 0 0 $200 ? $23f 1 1 0 0 1 $240 ? $27f 1 1 0 1 0 $280 ? $2bf 1 1 0 1 1 $2c0 ? $2ff 1 1 1 0 0 $300 ? $33f 1 1 1 0 1 $340 ? $37f 1 1 1 1 0 $380 ? $3bf 1 1 1 1 1 $3c0 ? $3ff 0 x x x x mapping is off mapping is off table3 - 2: bank mapping address
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 22 - 4. cpu engine the SM5952E engine is composed of four components: (1) control unit (2) arithmetic ? logic unit (3) memory control unit (4) ram and sfr control unit the SM5952E engine allows to fetch instruction from program memory and to execute using ram or sfr. the following chapter describes the main engine register. mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst 8051 core acc accumulator e0 h acc.7 acc.6 acc.5 acc.4 acc.3 acc.2 acc.1 acc.0 00h b b register f0h b.7 b.6 b.5 b.4 b.3 b.2 b.1 b.0 00h psw program status word d0h cy ac f0 rs[1:0] ov psw.1 p 00h sp stack pointer 81h sp[7:0] 07h dpl data pointer low 82h dpl[7:0] 00h dph data poi nter high 83h dph[7:0] 00h 4.1 accumulator acc is the accumulator register. most instructions use the accumulator to store the operand. mnemonic: acc address: e0h 7 6 5 4 3 2 1 0 reset acc.7 acc.6 acc05 acc.4 acc.3 acc.2 acc.1 acc.0 00h acc[7:0]: the a (or acc) register is the standard 8052 accumulator. 4.2 b register the b register is used during multiply and divide instructions. it can also be used as a scratch pad register to store temporary data. mnemonic: b address: f0h 7 6 5 4 3 2 1 0 reset b.7 b.6 b.5 b.4 b.3 b.2 b.1 b.0 00h b[7:0]: the b register is the standard 8052 register that serves as a second accumulator.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 23 - 4.3 program status word mnemonic: psw address: d0h 7 6 5 4 3 2 1 0 reset cy ac f0 rs [1:0] ov f1 p 00h cy: carry flag. ac: auxiliar y carry flag for bcd operations. f0: general purpose flag 0 available for user. rs[1:0]: register bank select, used to select working register bank. rs[1:0] bank selected location 00 bank 0 00h ? 07h 01 bank 1 08h ? 0fh 10 bank 2 10h ? 17h 11 bank 3 18h ? 1fh ov: overflow flag. f1: general purpose flag 1 available for user. p: parity flag, affected by hardware to indicate odd/even number of ?one? bits in the accumulator, i.e. even parity. 4.4 stack pointer the stack pointer is a 1 - byte register init ialized to 07h after reset. this register is incremented before push and call instructions, causing the stack to start from location 08h. mnemonic: sp address: 81h 7 6 5 4 3 2 1 0 reset sp [7:0] 07h sp[7:0]: the stack pointer stores the scratchpad ra m address where the stack begins. in other words, it always points to the top of the stack. 4.5 data pointer the data pointer (dptr) is 2 - bytes wide. the lower part is dpl, and the highest is dph. it can be loaded as a 2 - byte register (e.g. mov dptr, #data16 ) or as two separate registers (e.g. mov dpl,#data8). it is generally used to access the external code or da ta space (e.g. movc a,@a+dptr or movx a, @dptr respectively). mnemonic: dpl address: 82h 7 6 5 4 3 2 1 0 reset dpl [7:0] 00h dpl[7:0]: data poi nter low mnemonic: dph address: 83h 7 6 5 4 3 2 1 0 reset dph [7:0] 00h dph [7:0]: data pointer high
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 24 - 5. gpio port 0 ~ port 4 are the general purpose io of this controller. most of the ports are multiplexed with the other outputs, e.g., port 3[ 0] is also used as rxd in the uart application. port 0 is open - drain in the input and output high condition, so external pull - up resistors are required. as for the other ports, the pull - up resistors are built internally. for general purpose applications, every pin can be assigned to either high or low independently because their sfrs are bit addressable as given below mnemonic: p0 address: 80h 7 6 5 4 3 2 1 0 reset p0.7 p0.6 p0.5 p0.4 p0.3 p0.2 p0.1 p0.0 ffh p0.7~ 0: port0 [7] ~ port0[0] mnemonic: p1 address: 90h 7 6 5 4 3 2 1 0 reset p1.7 p1.6 p1.5 p1.4 p1.3 p1.2 p1.1 p1.0 ffh p1.7~ 0: port1 [7] ~ port1 [0] mnemonic: p2 address: a0h 7 6 5 4 3 2 1 0 reset p2.7 p2.6 p2.5 p2.4 p2.3 p2.2 p2.1 p2.0 ffh p2. 7 ~ 0: port2 [ 7 ] ~ port2 [0] mnem onic: p 3 address: b0h 7 6 5 4 3 2 1 0 reset p3.7 p3.6 p3.5 p3.4 p3.3 p3.2 p3.1 p3.0 ffh p 3 . 7 ~ 0: port 3 [ 7 ] ~ port 3 [0] mnemonic: p 4 address: d 8 h 7 6 5 4 3 2 1 0 reset - - - - p 4 .3 p 4 .2 p 4 .1 p 4 .0 x fh p 4 . 3 ~ 0: port 4 [ 3 ] ~ port 4 [0]
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 25 - 6. time r 0 and timer 1 the SM5952E has three 16 - bit timer/counter registers: timer 0, timer 1 and timer 2. all can be configured for counter or timer operations. in timer mode, the timer 0 register or timer 1 register is incremented every machine cycles, d ue to 1 2 oscillator periods in a machine cycle, the count rate is 1/12 of the oscillator frequency. if in 6t mode, the count rate is 1/ 6 of the oscillator frequency . in counter mode, the register is incremented when the falling edge is observed at the correspondi ng input pin t0 or t1. since it takes 2 machine cycles to recognize a 1 - to - 0 event, the maximum input count rate is 1/2 of the oscillator frequency. there are no restrictions on the duty cycle, however to ensure proper recognition of 0 or 1 state, an input should be stable for at least 1 machine cycle. four operating modes can be selected for timer 0 and timer 1. two special f unction registers (tmod and tcon) are used to select the appropriate mode. mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 b it 2 bit 1 bit 0 rst timer 0 and 1 tl0 timer 0 , low byte 8ah tl0[7:0] 00h th0 timer 0 , high byte 8ch th0[7:0] 00h tl1 timer 1 , low byte 8bh tl1[7:0] 00h th1 timer 1 , high byte 8dh th1[7:0] 00h tmod timer mode control 89h gate c/t m1 m0 gate c/t m 1 m0 00h tcon timer/counter control 88h tf1 tr1 tf0 tr0 ie1 it1 ie0 it0 00h 6.1 timer/counter mode control register (tmod) mnemonic: tmod address: 89h 7 6 5 4 3 2 1 0 reset gate c/t m1 m0 gate c/t m1 m0 00h timer 1 timer 0 gate: if set, enables extern al gate control (pin int0 or int1 for counter 0 or 1, respectively). when int0 or int1 is high, and trx bit is set (see tcon register), a counter is incremented every falling edge on t0 or t1 input pin . c/t: selects timer or counter operation. when set to 1, a counter operation is performed, when cleared to 0, the corresponding register will function as a timer. m1 m0 mode function 0 0 mode0 13 - bit counter/timer, with 5 lower bits in tl0 or tl1 register and 8 bits in th0 or th1 register (for timer 0 and t imer 1, respectively). the 3 high order bits of tl0 and tl1 are hold at zero. 0 1 mode1 16 - bit counter/timer. 1 0 mode2 8 - bit auto - reload counter/timer. the reload value is kept in th0 or th1, while tl0 or tl1 is incremented every machine cycle. when tlx overflows, a value from thx is copied to tlx.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 26 - 1 1 mode3 if timer 1 m1 and m0 bits are set to 1, timer 1 stops. if timer 0 m1 and m0 bits are set to 1, timer 0 acts as two independent 8 bit timers / counters. 6.2 timer/counter control register (tcon) mnem onic: tcon address: 88h 7 6 5 4 3 2 1 0 reset tf1 tr1 tf0 tr0 ie1 it1 ie0 it0 00h tf1: timer 1 overflow flag set by hardware when timer 1 overflows. this flag can be cleared by software and is automatically cleared when interrupt is processed. tr1: ti mer 1 run control bit. if cleared, timer 1 stops. tf0: timer 0 overflow flag set by hardware when timer 0 overflows. this flag can be cleared by software and is automatically cleared when interrupt is processed. tr0: timer 0 run control bit. if cleared, timer 0 stops. ie1: interrupt 1 edge flag. set by hardware, when falling edge on external pin int1 is observed. cleared when interrupt is processed. it1: interrupt 1 type control bit. selects falling edge or low level on input pin to cause interrupt. it1 =1, interrupt 1 select falling edge trigger. it1=0, interrupt1 select low level trigger. ie0: interrupt 0 edge flag. set by hardware, when falling edge on external pin int0 is observed. cleared when interrupt is processed. it0: interrupt 0 type control b it. selects falling edge or low level on input pin to cause interrupt. it0=1, interrupt 0 select falling edge trigger. it0=0, interrupt 0 select low level trigger. 6.3 mode 0 (13 - bit counter/timer) the timer register is configured as a 13 - bit register. as th e count rolls over from all 1s to all 0s, it sets the timer interrupt flag tfx. the counted input is enabled to the timer when trx = 1 and either gate=0 or intx = 1. mode 0 operation is the same for timer0 and timer1. fig. 6 - 1 : mode 0 - 13 bit timer / counter operation
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 27 - 6.4 mode 1 (16 - bit counter/timer) mode1 is the same as mode0, except that the timer register is being run with all 16 bits. fig. 6 - 2 : mode 1 16 bit counter/timer operation 6.5 mode 2 (8 - bit auto - reload counter/timer) mode 2 configures the timer register as an 8 - bit counter(tlx) with automatic reload. overflow from tlx not only set tfx, but also reload tlx with the content of thx, which is determined by software. the reload leaves thx unchan ged. mode 2 operation is the same for timer0 and timer1. fig. 6 - 3 : mode 2 8 - bit auto - reload counter/timer operation. 6.6 mode 3 (timer 0 acts as two independent 8 bit timers / counters) timer1 in mode3 simply holds its count, the effect is the same as setting tr1 = 1. timer0 in mode 3 enables tl0 and th0 as two separate 8 - bit counters. tl0 uses the timer0 control bits such like c/t, gate, tr0, int0 and tf0. th0 is locked into a timer function (can not be external event counter) and take over the use of tr1, tf1 from timer1. th0 now controls the timer1 interrupt.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 28 - fig. 6 - 4 : mode 3 timer 0 acts as two independent 8 bit timers / counters operatin
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 29 - 7. timer 2 timer2 is a 16 - bit timer/counter which can oper ate as either an event timer or an event counter as selected by c/t2 in the s pecial function register t2con. mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst timer 2 tl2 timer 2 , low byte cch tl2[7:0] 00h th2 timer 2 , hig h byte cdh th2[7:0] 00h rcap2l reload and capture data low byte cah rcap2l[7:0] 00h rcap2h reload and c apture data high byte cbh rcap2h[7:0] 00h t2mod timer 2 m ode c9h - - - - - - t2oe dcen 0 0 h t2con timer 2 c ontrol r egister c8h tf2 exf2 rclk tclk exen 2 tr2 c/ t2 cp/ rl2 00h mnemonic: t2mod address: 98h 7 6 5 4 3 2 1 0 reset - - - - - - t2oe dcen 00h t2oe : timer 2 output enable bit. it enables timer 2 overflow rate to toggle p1.0. dcen : down count enable bit . when set, this allows timer 2 to be configured as an up/down counter . mnemonic: t2con address: 98h 7 6 5 4 3 2 1 0 reset tf2 exf2 rclk tclk exen2 tr2 c/ t2 cp/ rl2 00h tf2 : timer 2 overflow flag is set by a ti mer 2 overflow and must be cleared by software. tf2 will not be set when either rclk = 1 or tclk = 1. exf2 : timer 2 external flag is set when either a capture or reload is caused by a negative transition on t2ex and exen2 = 1. when timer 2 interrupt is en abled, exf2 = 1 will cause the cpu to vector to the timer 2 interrupt routine. exf2 must be cleared by software. exf2 does not cause an interrupt in up/down counter mode (dcen = 1). rclk : receive clock enable. when set, causes the serial port to use timer 2 overflow pluses for it ? s receive clock in serial port modes 1 and 3. rclk = 0 causes timer 1 overflows to be used for the receive clock. tclk : transmit clock enable. when set, causes the serial port to use timer 2 overflow pulses for it?s transmit cloc k in serial port modes 1 and 3. tclk = 0 causes timer 1 overflows to be used for the transmit clock.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 30 - exen2 : timer 2 external enable bit . when set, allows a capture or reload to occur as a result of a negative transition on t2ex if timer 2 is not being use d to clock the serial port. exen2 = 0 causes timer 2 to ignore events at t2ex. tr2 : start/stop control for timer 2. tr2 = 1 starts the timer. c/ t2 : timer or counter select for timer 2. c/ t2 = 0 for timer function . c/ t2 = 1 for external event counter (falling edge triggered). cp/ rl2 : capture/reload select. cp/ rl2 = 1 causes captures to occur on negative transitions at t2ex if exen2 = 1. cp/ rl2 = 0 causes automatic reloads to occur when timer 2 overflows or negative transitions occur at t2ex when exen2 = 1. when either rclk or tclk = 1, this bit is ignored and the timer is forced to auto - reload on timer 2 overflow. table 7 - 1 : timer 2 operating modes rclk + tclk cp/rl2 tr2 dcen mode x x 0 x off 1 x 1 0 baud - rate generation 0 1 1 0 capture 0 0 1 0 auto - reload up - only 0 0 1 1 auto - reload up/down 7.1 capture mode in the capture mode, there are two options selected by bit exen2 in t2con . if exen2 = 0, timer 2 is a 16 - bit timer or counter which upon overflow sets bit tf2 in t2con. this bit can then be used to generate an interrupt. if exen2 = 1, timer 2 still does the above, but with the added feature that a 1 - to - 0 transition at external input t2ex causes the current value in th2 and tl2 to be captured into rcap2h and rcap2l, respectively. in addition, the transition at t2ex causes bit exf2 in t2con to be set. the exf2 bit, like tf2, can generate an interrupt. c/t2=0 c/t2=1 t2 pin tl2 (8 bits) th2 (8 bits) tf2 fosc/12 tr2 rcap2l rcap2h t2 ex pin exen2 exf2 transition detector timer2 interrupt timier2 in capture mode fig . 7 - 1 timer 2 in capture mode
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 31 - 7.2 auto - reload (up or down counter) timer 2 can be programmed to count up or down when configured in its 16 - bit auto - reload mode. this feature is invoked by a bit named dcen (down counter enable) located in the sfr t2mod. upon reset , the dcen bit is set to 0 so that timer 2 will default to count up. when dcen is set, timer 2 can count up or down depending on the value of the t2ex pin. fig . 7 - 2 shows timer 2 automatically counting up when dcen = 0. in this mode there are two options selected by bit exen2 in t2con. if exen2 = 0, timer 2 counts up to ffffh and then sets the tf2 bit upon overflow. the overflow also causes the timer registers to be reloaded with the 16 - bit value in rcap2h and rcap2l. the values in rcap2h and rcap2l are pr eset by software. if exen2 = 1, a 16 - bit reload can be triggered either by an overflow or by a 1 - to - 0 transition at external input t2ex. this transition also sets the exf2 bit. both the tf2 and exf2 bits can generate an interrupt if enabled. setting the dcen bit enables timer 2 to cou nt up or down as shown in fig . 7 - 3. in this mode the t2ex pin controls the direction of count. a logic 1 at t2ex makes timer 2 count up. the timer will overflow at ffffh and set the tf2 bit. this overflow also causes the 16 - bit value in rcap2h and rcap2l to be reloaded into the timer registers, th2 and tl2, respectively. a logic 0 at t2ex makes timer 2 count down. now the timer underflows when th2 and tl2 are equal to the values stored in rcap2h and rcap2l. the underflow set s the tf2 bit and causes ffffh to be reloaded into the timer registers. the exf2 bit toggles whenever timer 2 overflows or underflows. this bit can be used as a 17th bit of resolution if desired. in this operating mode, exf2 does not flag an interrupt. c/t2=0 c/t2=1 t2 pin tl2 (8 bits) th2 (8 bits) tf2 fosc/12 tr2 rcap2l rcap2h t2 ex pin exen2 exf2 transition detector timer2 interrupt timier2 in auto reload mode (dcen=0) reload fig . 7 - 2 t imer 2 in auto reload mode (dcen=0)
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 32 - c/t2=0 c/t2=1 t2 pin tl2 th2 tf2 fosc/12 tr2 rcap2l rcap2h timier2 in auto reload mode (dcen=1) ffh ffh exf2 t2ex pin count direction 1 = up 0 = down timer2 interrupt fig . 7 - 3 timer 2 in auto reload mode (dcen=1) 7.3 programmable clock out a 50% duty cycle clock can be programmed to come out on p1.0. this pin, besides begin a regular i/o pin, has two alternate functions. it can be programmed (1) to input the external clock for timer/counter 2 or (2) to output a 50% duty cycle clock. an example is that the clock output ranges from 61hz to 4mhz at a 16mhz oscillator freq uency if in 12t mode. to configure the timer/counter 2 as a clock generator, bit c/ 2 t (t2con.1) must be cleared and bit t2oe(t2mod.1) must be set. bit tr2 (t2con.2) starts and stops the timer. the clock - out frequency depends on the o scillator frequency and the reload value of timer 2 capture registers (rcap2h, rcap2l) as shown in this equation: clock - out frequency = ) 2 , 2 65536 ( 4 frequency oscillator l rcap h rcap ? in the clock - out mode, timer 2 roll - overs will not generate an interrupt. this is similar to w hen timer 2 is used as a baud- rate generator. it is possible to use timer 2 as a baud - rate generator and a clock generator simultaneously. note, however, that the baud - rate and clock - out freque ncies can not be determined independently from one another sinc e they both use rcap2h and rcap2l.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 33 - fig . 7 - 4 timer 2 in clock - out mode
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 34 - 8. serial interface ? uart the serial buffer consists of two separate registers, a t ransmit buffer and a receive buffer. writing data to the special function registe r sbuf sets this data in serial output buffer and starts the transmission . reading from the sbuf reads data from the serial receive buffer. the serial port can simultaneously t ransmit and receive data. it can also buffer 1 byte at receive, which prevents t he receive data from being lost if the cpu reads the first byte before transmission of the second byte is completed. mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst serial interface pcon power c ontrol 87h smod - - - gf1 gf0 pd idle 00h scon serial port c ontrol r egister 98h sm 0 sm 1 sm 2 ren tb8 rb8 ti ri 00h sbuf serial port d ata b uffer 99h sbuf[7:0] 00h mnemonic: scon address: 98h 7 6 5 4 3 2 1 0 reset sm 0 sm 1 sm 2 ren tb8 rb8 ti ri 00h sm 0, sm 1: serial port mode selec tion. sm 0 sm 1 mode 0 0 0 0 1 1 1 0 2 1 1 3 the 4 modes in uart, mode 0 ~ 3, are explained later. sm 2: enables multi processor communication feature . ren: if set, enables serial reception. cleared by software to disable reception. tb8: the 9th tran sm itted data bit in modes 2 and 3. set or cleared by the cpu depending on the function it performs such as parity check, multiprocessor communication etc. rb8: in modes 2 and 3, it is the 9th data bit received. in mode 1, if sm 2 is 0, rb8 is the stop bit. i n mode 0, this bit is not used. must be cleared by software. ti: tran sm it interrupt flag, set by hardware after completion of a serial transfer. must be cleared by software . ri : receive interrupt flag, set by hardware after completion of a serial recepti on. must be cleared by software. 8.1 serial interface the serial interface can operate in the following 4 modes: sm 0 sm 1 mode description board rate 0 0 0 shift register fosc/12 0 1 1 8 - bit uart variable 1 0 2 9 - bit uart fosc/32 or fosc/64 1 1 3 9 - bit ua rt variable here fosc is the crystal or oscillator frequency.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 35 - the serial port is full duplex, can transmit and receive simultaneously. the serial port receive and transmit share the same sfr ? sbuf, but actually there is two sbuf in the chip, one is for t ransmit and the other is for receive. the serial port can be operated in 4 different modes. 8.1.1 mode 0 pin rxd serves as input and output. txd outputs the shift clock. 8 bits are tran sm itted with lsb first. the baud rate is fixed at 1/12 of the crystal frequen cy. reception is initialized in mode 0 by setting the flags in scon as follows: ri = 0 and ren = 1. in other modes, a start bit when ren = 1 starts receiving serial data. a s shown in fig. 8 - 1 and fig. 8 - 2 fig. 8 - 1 : tran sm it mode 0 fig. 8 - 2 : receive mode 0 8.1.2 mode 1 pin rxd serves as input, and txd serves as serial output. no external shift clock is used, 10 bits are tran sm itted: a start bit (always 0), 8 data bits (lsb first), and a stop bit (always 1). on receive, a start bit synchronizes the tran sm ission, 8 data bits are available by reading sbuf, and stop bit sets the flag rb8 in the special function register scon . in mode 1 either internal baud rate generator or timer 1 can be use to specify baud rate. a s shown in fig. 8 - 3 and fig. 8 - 4 fig. 8 - 3 : trans mit mode 1
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 36 - fig. 8 - 4 : receive mode 1 8.1.3 mode 2 this mode is similar to mode 1, with two differences. the baud rate is fixed at 1/32 ( smod =1) or 1/64( smod =0) of oscillator frequency and 11 bits are transmitted or received: a star t bit (0), 8 data bits (lsb first), a programmable 9th bit, and a stop bit (1). the 9th bit can be used to control the parity of the serial interface: at transmission , bit tb8 in scon is output as the 9th bit, and at receive, the 9th bit affects rb8 in spe cial function register scon. 8.1.4 mode 3 the only difference between mode 2 and mode 3 is that in mode 3 either internal baud rate generator or timer 1 can be use to specify baud rate. a s shown in fig. 8 - 5 and fig. 8 - 6 . fig. 8 - 5 : transmit modes 2 and 3 fig. 8 - 6 : receive modes 2 and 3 8.2 multiprocessor communication of serial interface the feature of receiving 9 bits in m odes 2 and 3 of serial interface can be used for multiprocessor communication. in this case, the slave processors have bit sm 2 in scon set to 1. when the master processor outputs slave?s address, it sets the 9th bit to 1, causing a serial port receive inte rrupt in all the slaves. the slave processors compare the received byte with their network address. if there is a match, the addressed slave will clear sm 2 and receive the rest of the message, while other slaves will leave sm 2 bit unaffected and ignore thi s message. after addressing the slave, the host will output the rest of the message with the 9th bit set to 0, so no serial port receive interrupt will be generated in unselected slaves.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 37 - 8.3 baud r ate g enerator 8.3.1 serial interface mode 0 baud rate = 12 fosc 8.3.2 serial interface mode 2 baud rate = 64 2 smod ( fosc ) 8.3.3 serial interface mode 1 and 3 8.3.3.1 using timer 1 to generate baud rates. baud rate = 32 2 smod (timer 1 overflow rate) = ] 1 256 [ 12 fosc 32 2 th smod ? 8.3.3.2 u sing timer 2 to generate baud rates. baud rate = 32 rate overflow 2 timer = rcap2l)] (rcap2h, - [65536 32 fosc
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 38 - 9. interrupt the SM5952E provides 7 interrupt sources with two priority levels. each source has its own request flag(s) located in a special function register. each interrupt requested by the corresponding flag could individually be enabled or disabled by the enabl e bits in sfr?s ie . when the interrupt occurs, the engine will vector to the predetermined address as given in table 9 - 1 . once interrupt service has begun, it can be interrupted only by a higher priority interrupt. the interrupt service is terminated by a return from instruction reti. when an reti is performed, the processor will return to the instruction that wo uld have been next when interrupt occurred. when the interrupt condition occurs, the processor will also indicate this by setting a flag bit. this bit is set regardless of whether the interrupt is enabled or disabled. each interrupt flag is sampled once pe r machine cycle, and then samples are polled by hardware. if the sample indicates a pending interrupt when the interrupt is enabled, then interrupt request flag is set. on the next instruction cycle the interrupt will be acknowledged by hardware forcing an lcall to appropriate vector address. interrupt response will require a varying amount of time depending on the state of microcontroller when the interrupt occurs. if microcontroller is performing an interrupt service with equal or greater priority, the ne w interrupt will not be invoked. in other cases, the response time depends on current instruction. table 9 - 1 : interrupt vectors priority level interrupt request flags interrupt vector address interrupt number *(use keil c to ol) 1 (highest) ie0 ? external interrupt 0 0003h 0 2 tf0 ? timer 0 interrupt 000bh 1 3 ie1 ? external interrupt 1 0013h 2 4 tf1 ? timer 1 interrupt 001bh 3 5 ri/ti ? serial channel interrupt 0023h 4 6 tf2/exf2 ? timer 2 interrupt 002bh 5 7 two wire serial interface 003b h 7 *see keil c about c51 user?s guide about interrupt function description mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst interrupt ie interrupt e nable r egister a8h ea - et2 es et1 ex1 et0 ex0 00h ie1 interrupt e nable register 1 a9h - - - - - - etwsi - 00h ip interrupt p riority r egister b8h - - pt2 ps pt1 px1 pt0 px0 00h ip1 interrupt p riority r egister 1 b9h - - - - - - ptwsi - 00h mnemonic: ie address: a8h 7 6 5 4 3 2 1 0 reset ea - et2 es e t1 ex1 et0 ex0 00h ea: ea=0 ? disable all interrupt. ea=1 ? enable all interrupt.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 39 - et2: et2=0 ? disable timer 2 overflow or external reload interrupt. et2=1 ? enable timer 2 overflow or external reload interrupt. es: es=0 ? disable serial channel interr upt. es=1 ? enable serial channel interrupt. et1: et1=0 ? disable timer 1 overflow interrupt. et1=1 ? enable timer 1 overflow interrupt. ex1: ex1=0 ? disable external interrupt 1. ex1=1 ? enable external interrupt 1. et0: et0=0 ? disable timer 0 overflo w interrupt. et0=1 ? enable timer 0 overflow interrupt. ex0: ex0=0 ? disable external interrupt 0. ex0=1 ? enable external interrupt 0. mnemonic: ie 1 address: a 9 h 7 6 5 4 3 2 1 0 reset - - - - - - etwsi - 00h etwsi : etwsi =0 ? disable twsi interrupt . etwsi =1 ? enable twsi interrupt . mnemonic: ip address: b8 h 7 6 5 4 3 2 1 0 reset - - pt2 ps pt1 px1 pt0 px0 00h pt2 : timer2 interrupt priority bit. ps : serial port interrupt priority bit. pt1 : timer1 interrupt priority bit. px1 : external interr upt 1 priority bit. pt0 : timer 0 interrupt priority bit. px0 : external interrupt 0 priority bit. mnemonic: ip 1 address: b 9 h 7 6 5 4 3 2 1 0 reset - - - - - - ptwsi - 00h ptwsi : twsi interrupt priority bit. interrupt priority table ip.x priority l evel 1 1 (highest) 0 2
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 40 - 10. watch dog timer the watch dog timer (wdt) is an 16- bit free - running counter that generate reset signal if the counter overflows. the wdt is useful for systems which are susceptible to noise, power glitches, or electronic s discharge which causing software dead loop or runaway. the wdt function can help user software recover from abnormal software condition. the wdt is different from timer0, timer1 and timer2 of general 8052. to prevent a wdt reset can be done by software p eriodically clearing the wdt counter. user should check wd r bit of sconf register whenever un- predicted reset happened. after an external reset the watchdog timer is disabled and all registers are set to zeros. the wdt has selectable divider input for the time base source clock. to select the divider input, the setting of bit 2 ~ bit0 ( ps[ 2 :0]) of watch dog timer control register (wdtc) should be set accordingly . as shown in table 10 - 1 . to enable the wdt is done by setting 1 to the bit 7 (wdte) of wdtc. after wdte set to 1, the 16 - bit counter starts to count with the selected time base source clock which set by ps2~ps0. it will generate a reset signal when overflows. the wdte bit will be cleared to 0 automatically wh en SM5952E been reset, either hardware reset or wdt reset. to reset the wdt is done by setting 1 to the bit 5 (clear) of wdtc. this will clear the content of the 16 - bit counter and let the counter re - start to count from the beginning. table 10- 1 : wdt time - out period ps[ 2 :0] divider (dividing of fosc) time period @ 40 m hz 000 8 13.1ms 001 16 26.21ms 010 32 52.42ms 011 64 104.8ms 100 128 209.71ms 101 256 419.43ms 110 512 838.86ms 111 1024 1677.72ms fosc 3 0] : ps[2 2 1 + wdtc ps[2:0] wdten enable/disable wdt wdt counter wdtclk clr refresh wdt counter 1. power on reset 2. external reset 3. software write ?0? wdr set wdr = 1 clear wdtf = 0 wdt time-out reset wdt time-out select fig. 10 - 1 : watchdog timer block diagram
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 41 - mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst watchdog timer wdtc watchdog t imer c ontrol r egister 9fh wdte - clear - - ps [2:0] 00h sconf s ystem control register bfh wdr - - pdwue - ispe ome alei 0 2 h mnemonic: wdtc address: 9fh 7 6 5 4 3 2 1 0 reset wdte - clear - - ps [2:0] 00h wdte: watch dog timer enable bit. clear: watch dog timer clear bit. if clear bit set to1, s etting this bit the watchdog timer counter clear and re - start to count from the beginning . ps [2:0] : watch d og timer over flow period setting. mnemonic: sconf address: bfh 7 6 5 4 3 2 1 0 reset wdr - - pdwue - ispe ome alei 0 2 h wdr watch dog timer reset. when system reset by watch dog timer overflow, wdr will be set to 1. user should check wdr bit whenever un - predicted reset happened.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 42 - 11. power management unit power management unit serves two power management modes, i dle and power down , for the users to do power saving function. mnemonic: pcon address: 87h 7 6 5 4 3 2 1 0 reset smod - - - gf1 gf0 pd idle 00h gf1 : general - purpose flag bit. gf0 : general - purpose flag bit. pd : power down mode control bit. setting this bit turning on the pd mode. pd bit is always read as 0 idle: idle mode control bit. setting this bit turning on the idle mode. idle bit is always read as 0 11.1 idle mode an instruction that sets pcon.0 causes that to be the last instruction executed before going into the idle mode, the inter nal clock is gated off to the cpu but not to the interrupt, timer and serial port functions. there are two ways to terminate the idle. activation of any enabled interrupt will cause pcon.0 to be cleared by hardware, terminating the idle mode. the interrup t will be serviced, and following reti, the next instruction to be executed will be the one following the instruction that put the device into idle. another way to wake - up from idle is to pull reset high to generate internal hardware reset. 11.2 power down mode an instruction that sets pcon.1 cause that to be the last instruction executed before going into the power - down mode. in the power - down mode, the on - chip oscillator is stopped. the contents of on - chip ram and sfrs are maintained. be carefully to keep rese t pin active for at least 10ms in order for a stable clock. the SM5952E can be resumed from power - down state by res et pin or external interrupt int 0/ int 1. when it is woken - up by reset, the program will execute from the address 0000h. when it is woken - up b y int 0 or int 1, the program will execute from the corresponding interrupt service routine. to enable wake - up by external interrupt pins, the associated interrupt control register (ea, ex0/ex1) must be configured correctly. additionally, the control bit pdw ue in sconf register must be enabled as well. mnemonic: sconf address: bfh 7 6 5 4 3 2 1 0 reset wdr - - pdwue - ispe ome alei 0 2 h pdwue : power down wake - up enable bit. set 1 to enable wake - up from power - down state by external pin int0 or int1.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 43 - the wake - up is initiated by an interrupt event at int 0 or int 1 pin, and is followed by an internal clock de - bouncing procedure. the de - bouncing logic effectively avoids cpu to run at unstable clock oscillation. pin status in idle mode and p ower - d own m ode mode program memory ale psen port0 port1 port2 port3 idle internal 1 1 data data data data idle external 1 1 float data address data power - down internal 0 0 data data data data power - down external 0 0 float data data data
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 44 - 12. pul se width modulation (pwm) there are two pwm channels in SM5952E . the resolution of pwm channel can be 8 - bit or 5 - bit depending on the setting on corresponding pbs bit in pwmcn register, where n - 0 or 1. pwmtb (8-bit timer) pwmps (2-bit timer) mux 4 2 { pfs1,pfs0 } pwmclk pwmdn[7:5] pwmdn[4:0] 8-bit or 5-bit logic comparator count[7:0] cmpout pwmoutn figure : pwmn functional block to p1.2 and p1.3 pbs ( 1 for 5-bit pwm) n=0,1 system clock mnemonic description dir . bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst pwm p1con p1 control register 9bh sdae scle - - pwm1e pwm0e - - 00h pwmc 0 pwm control register 0 d3 h - - - - - pbs pfs1 pfs0 00h pwmc 1 pwm control register 1 d4 h - - - - - pbs pfs1 pfs0 00h pwmd0 p wm data register 0 b3h d0.7 d0.6 d0.5 d0.4 d0.3 d0.2 d0.1 d0.0 00h pwmd1 pwm data register 1 b4h d 1 .7 d 1 .6 d 1 .5 d 1 .4 d 1 .3 d 1 .2 d 1 .1 d 1 .0 00h mnemonic: p 1 con address: 9bh 7 6 5 4 3 2 1 0 reset sdae scle - - pwm1e pwm0e - - 00h pwm1e : set 1 to configu re p1[3] as pwm channel 1 output. pwm0e : set 1 to configure p1[2] as pwm channel 0 output. mnemonic: pwmc[0:1] address: d3 h and d4h 7 6 5 4 3 2 1 0 reset - - - - - pbs pfs1 pfs0 00h pbs : w hen set, the pwm is 5 bits resolution. pfs [1:0] : the pwm cl ock divider select. pfs1 pfs0 pwm clock divider select 0 0 2 0 1 4 1 0 8 1 1 16
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 45 - mnemonic: pwmd [0:1] address: b3 h and b4h 7 6 5 4 3 2 1 0 reset d n .7 d n .6 d n .5 d n .4 d n .3 d n .2 d n .1 d n .0 00h where n=0 ~1. dn.7 ~ dn.0 : they are 8 - bit pwm dat a for 8 - bit resolution. dn.4 ~ dn.0 are pwm data for 5 - bit resolution.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 46 - 13. two - wire s eries interface ( twsi) two wire serial interface, is a serial interface in SM5952E , that is function compatible with i i c 400kps specification and is capable to communicate with standard iic devices via configuring SM5952E as one of iic device types - master transmitter, master receiver, slave transm itter or slave receiver device. mnemonic description dir. bit 7 bit 6 bit 5 bit 4 b it 3 bit 2 bit 1 bit 0 rst twsi p1con p1 control register 9bh sdae scle - - pwm1 e pwm0 e - - 00h twsis twsi status register c0h rxif txif tfail nakif - rxack mst txack 00h twsia twsi address register c1h adr.6 adr.5 adr.4 adr.3 adr.2 adr.1 adr.0 adr mk a0h twsic1 twsic control register 1 c2h twsie - - - bus busy twsif s2 twsif s1 twsif s0 01h twsic2 twsic control register 2 c3h matc h srw - - resta rt - - mrw 00h twsitxd twsi tx data register c4h txd.7 txd.6 txd.5 txd.4 txd.3 txd.2 txd.1 txd.0 ffh twsirxd twsi rx data register c5h rxd.7 rxd.6 rxd.5 rxd.4 rxd.3 rxd.2 rxd.1 rxd.0 00h ifr interrupt flag r egister aah - - - - - - twsiif - 00h mnemonic: p 1 con address: 9b h 7 6 5 4 3 2 1 0 reset sdae scle - - pwm1e pwm0e - - 00h sdae : set 1 to configure p1 [7] as sda pin of twsi. scle : set 1 to configure p1[6] as scl pin of twsi. mnemonic: twsis address: c0 h 7 6 5 4 3 2 1 0 reset rxif txif tfail nakif - rxack mst txack 00h rxif : twsi interrupt flag for data receiving. it is set after the twsi rxd (re ceive data buffer) is loaded with new received data. txif : twsi interrupt flag for data transmitting. it is set when the data of twsi txd (transmit data buffer) is downloaded onto the shift register or the twsia is downloaded onto the shift register at mas ter transmit mode. tfail : this flag is set when the data transmit is failed. (master mode only) nakif: non - acknowledge interrupt flag. it is only set in the master mode when there is no acknowledge bit detected after one byte data or calling address is transferred. rxack: the acknowledge status indicator. when clear, it means an acknowledge
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 47 - signal has been received after the complete 8 - bit data transmit on the bus. (read only) mst: set 1 to force working at twsi master mode. txack: the acknowledge bit for response to transmitter or master addressing. when receiving complete 8 - bit data, setting this bit to respond with nack otherwise ack is responded. mnemonic: twsi a address: c 1 h 7 6 5 4 3 2 1 0 reset adr.6 adr.5 adr.4 adr.3 adr.2 adr.1 adr.0 adrmk a 0h adr[6:0] : these 7 bits define slave address on the twsi/iic bus. adrmk : address mask bit . its only compare 4 bits msb when set this bit. when this bit is set, adr.2 ? adr.0 is masked to excluded from the address comparison. in other words, it will b e addressed ?hit? and respond with ack as long as adr6 - adr.3 is matched. mnemonic: twsic1 address: c2 h 7 6 5 4 3 2 1 0 reset twsie - - - busbusy twsifs2 twsifs1 twsifs0 0 1 h twsie : twsi function e nable bit. busbusy : when twsi bus is detected with ?st art? condition, this bit is set. when twsi bus is detected with ?stop? condition, this bit is cleared. (read only) twsifs[2:0] : twsi clock rate selector at master mode. twsifs[2:0] scl frequency 000 x tal/32 001 x tal/64 (default) 010 x tal/128 011 x ta l/256 100 x tal/512 101 x tal/1024 110 x tal/2048 111 x tal/4096 mnemonic: twsic 2 address: c3 h 7 6 5 4 3 2 1 0 reset match srw - - restart - - mrw 00h match : when the first received data (following the start signal) in twsir x d register is matches wit h the address that address register (twsia) set, this bit will set. (read only & slave mode only) srw : the slave mode read (received) or wrote (transmit) on the twsi bus. when this bit is set , the slave module transmit data on the twsi bus (sda). when thi s bit is clear, the slave module received data on the twsi bus (sda). (read
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 48 - only) restart : this bit only set by master mode. the master will send a start signal then send twsia after the ack signal when this bit s etting. if nakif was set (the n ack signal was received), the master mode will r elease, and this bit will clear . (master mode only) mrw: this bit is determined the data transmit direction. and this bit will transmit to bus as bit0 at address (address is collection twsia [7:1] and mrw as 8 bits dat a). when clear this bit the master is in transmits mode and clear is in receive mode. mnemonic: twsitxd address: c 4 h 7 6 5 4 3 2 1 0 reset txd.7 txd.6 txd.5 txd.4 txd.3 txd.2 txd.1 txd.0 ff h the data written into this register will be automatically downloaded to the shift register when the module detects a calling address is matched and the bit 0 of the received data is on e (slave transmit mode) or when the data in the shift register has been transmitted with received acknowledge bit (rxak) =0 in tra nsmit mode . mnemonic: twsi r xd address: c5 h 7 6 5 4 3 2 1 0 reset rxd.7 rxd.6 rxd.5 rxd.4 rxd.3 rxd.2 rxd.1 rxd.0 00h the twsi receive data buffer (twsir x d) contains the last received data when the match flag is one or the calling address from master when the match flag is zero. the twsir x d register will be updated after a data byte is received and the previ ous received data had been read out, otherwise the twsi module will pull down to scl line to inhabit the next data transfer. it is a read - only regi ster. the read operation of this register will clear the rxif flag. after the rxif flag is cleared, the register can load the received data again and set the rxif flag to generate interrupt request for reading the newly received data. mnemonic: ifr addres s: aa h 7 6 5 4 3 2 1 0 reset - - - - - - twsiif - 00h twsiif : it is the logic - ored result of following twsi flags : rxif, txif, tfif and nakif. firmware can poll this bit to check whether twsi?s flag is set. (read only)
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 49 - 14. in - system programming (in ternal isp) the SM5952E can generate flash control signal by internal hardware circuit. users utilize flash control register, flash address register and flash data register to perform the isp function without removing the SM5952E from the system. the sm595 2e provides internal flash control signals which can do flash program/chip erase/page erase/protect functions. user need to design and use any kind of interface which SM5952E can input data. user then utilize isp service program to perform the flash progra m/chip erase/page erase/protect functions. 14.1 isp service program the isp service program is a user developed firmware program which resides in the isp service program space. after user developed the isp service program, user then determine the size of the i sp service program. user need to program the isp service program in the SM5952E for the isp purpose. the isp service programs were developed by user so that it should includes any features which relates to the flash memory programming function as well as c ommunication protocol between SM5952E and host device which output data to the SM5952E . for example, if user utilize uart interface to receive/ t ransmit data between SM5952E and host device, the isp service program should include baud rate, checksum or pari ty check or any error - checking mechanism to avoid data transmission error. 14.2 lock bit (n) the lock bit n has two functions: one is for service program size configuration and the other is to lock the isp service program space from flash erase function. the i sp service program space address range $ 2 0 00 to $ 2 fff. it can be divided as blocks of n* 512 byte. (n=0 to 8). when n=0 means no isp function, all of 4 k byte flash memory can be used as program memory. when n=1 means isp service program occupies 512 byte wh ile the rest of 3 .5k byte flash memory can be used as program memory. the maximum isp service program allowed is 4 k byte when n= 8 . under such configuration, the usable program memory space is 8 k byte. the lock bit n function is different from the flash pro tect function. the flash erase function can erase all of the flash memory except for the locked isp service program space. if the flash not has been protected, the content of isp service program still can be read. if the flash has been protected, the overa ll content of flash program memory space including isp service program space can not be read. as given in table 1 4 - 1 . table 1 4 - 1 isp code area isp service program address 0 no isp se rvice program 1 512 bytes ($ 2 e0 0h ~ $ 2 fffh) 2 1k bytes ($ 2 c 00h ~ $ 2 fffh ) 3 1.5k bytes ($ 2 a0 0h ~ $ 2 fffh ) 4 2k bytes ($ 2 80 0h ~ $ 2 fffh ) 5 2.5 k bytes ($ 2 60 0h ~ $ 2 fffh ) 6 3k bytes ($ 2 4 00h ~ $ 2 fffh ) 7 3.5k bytes ($ 2 20 0h ~ $ 2 fffh ) 8 4 k bytes ($ 2 0 00h ~ $ 2 fffh ) isp service program configurable in n* 512 byte (n= 0 ~ 8)
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 50 - 14.3 program the isp service program after lock bit n is set and isp service program been programmed, the isp service program memory will be protected (locked) automatically. the lock bit n has its own program/erase timing. it is different from the flash memory program/erase timing so the locked isp service program can not be erased by flash erase function. if user needs to erase the locked isp service program, he can do it by writer only. user c an not change isp service program when SM5952E was in system. 14.4 initiate isp service program to initiate the isp service program is to load the program counter (pc) with start address of isp service program and execute it. there are three ways to do so: (1) bla nk reset. hardware reset with first flash address blank ($0000=#ffh) will load the pc with start address of isp service program. (2) execute jump instruction can load the start address of the isp service program to pc. (3) reset is asserted with p2.6 and p2.7 bo th at low state. the default is enable. user can change enable or disable by writer. (4) reset is asserted with p4.3. the default is enable. user can change enable or disable by writer. during the strobe window, the hardware will detect the status of p2.6 & p2. 7 or p4.3 . if they meet one of above conditions, chip will switch to isp mode automatically. after isp service program executed, user need to reset the SM5952E , either by hardware reset or by wdt, or jump to the address $0000 to re - start the firmware progr am. p2.6 p2.7 rst 100ms 100ms p4.3 rst 100ms 100ms
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 51 - 14.5 isp register ? ispfah, ispfal, ispfd and isp c mnemonic description dir. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rst isp function ispfah isp flash address ? high r egister f4 h is pfah [7:0] 00h ispfal isp flash address - low r egister f5 h ispfal [7:0] 00h ispfd isp flash data r egister f6 h ispfd [7:0] 00h isp c isp control r egister f7h start isppg s e isppgs [1:0] - - ispf[1:0] 00h mnemonic: ispfah address: f4 h 7 6 5 4 3 2 1 0 rese t ispfah7 ispfah6 ispfah5 ispfah4 ispfah3 ispfah2 ispfah1 ispfah0 00 h ispfah [ 7 :0]: flash address - high for isp function . mnemonic: ispfal address: f5 h 7 6 5 4 3 2 1 0 reset ispfal7 ispfal6 ispfal5 ispfal4 ispfal3 ispfal2 ispfal1 ispfal0 00 h ispfal [7:0]: flash address - low for isp function . the ispfah & ispfal provide the 16- bit flash memory address for isp function. the flash memory address should not include the isp service program space address. if the flash memory address indicated by ispfah & ispfal registers overlay with the isp service program space address, the flash program/page erase of isp function executed thereafter will have no effect. mnemonic: ispfd address: f6 h 7 6 5 4 3 2 1 0 reset ispfd7 ispfd6 ispfd5 ispfd4 ispfd3 ispfd2 ispf d1 ispfd0 00 h ispfd [7:0]: flash data for isp function. the ispfd provide the 8 - bit data register for isp function. mnemonic: isp c address: f7h 7 6 5 4 3 2 1 0 reset start isppgs e isppgs [1:0] - - ispf[1:0] 00h start: isp function start bit . = 1: s tart isp function which indicated by bit 1, bit 0 (ispf[1:0]) . = 0: no operation . isppgse : isp page selection enable bit. = 1: enable. = 0: disable.
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 52 - isppgs [1:0] : isp page selection. isppgse, isppgs1,isppgs0 p er page in isp page erase operation 00 0 512 byte 0 01 512byte 0 10 512byte 0 11 512byte 100 512byte 101 256byte 110 128byte 111 reserved ispf [1 :0]: isp function select bit. ispf[ 1 :0] isp function 00 byte program 01 chip protect 10 page erase 11 chip erase the choice isp function w ill start to execute once the software write data to isp c register. to perform byte program/page erases isp function, user need to specify flash address at first. when performing page erase function, SM5952E will erase entire page which flash address indic ated by ispfah & ispfal registers located within the page. to perform the chip erase isp function, SM5952E will erase all the flash program memory except the isp service program space. to perform chip protect isp function, the SM5952E flash memory content will be read #00h. the program will miss the interrupt if it happens during the isp funtion. e.g. isp service program to do the byte program - to program #22h to the address $1005h clr ea ;disable interrupt mov ispfd , #55h mov ispfd , #0aah mov isp fd , #5 5 h ; enable ispe write attribute orl s con f , #0 4 h ; enable isp function mov ispfah, #10h ; set flash address - high, 10h mov ispfal, #05h ; set flash address - low, 05h mov ispfd, #22h ; set flash data to be programmed, data = 22h mov isp c, # 8 0h ; start to program #22h to the flash address $1005h anl s con f , #0f b h ; disable isp function setb ea ; enable interrupt
sm595 2e 8 - bit micro - controller 8 kb with 4kb isp flash & 1k b ram embedded specifications subject to change without notice contact your sales representatives for the most re cent information. issfd - m 0 91 ver c sm595 2e 0 4 / 17 /201 5 - 53 - operating conditions symbol description min. typ. max. unit. remarks ta operating temperature - 40 25 85 am bient temperature under bias vdd supply voltage 2. 4 5.5 v dc characteristics ta = - 40 to 85 , vcc = 5.0v symbol parameter valid min. max. unit test conditions vil1 input low voltage port 0,1,2,3,#ea - 0.5 0.8 v vil2 input low voltage res, xtal1 0 0.8 v vih1 input high voltage port 0,1,2,3,#ea 2.0 vcc+0.5 v vih2 input high voltage res, xtal1 70%vcc vcc+0.5 v vol1 output low voltage port 0, ale, #psen 0.45 v iol=3.2ma vol2 output low voltage port 1,2,3, 0.45 v iol=1.6ma voh1 output high vo ltage port 0 2.4 v ioh= - 800ua 90%vcc v ioh= - 80ua voh2 output high voltage port 1,2,3,ale,#psen 2.4 v ioh= - 60ua 90%vcc v ioh= - 10ua iil logical 0 input current port 1,2,3 - 75 ua vin=0.45v itl logical transition current port 1,2,3 - 650 ua vin =2.0v ili input leakage current port 0, #ea 10 ua 0.45v


▲Up To Search▲   

 
Price & Availability of SM5952E

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X